package com.micro.service.config;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Create by Vic Xu on 2019/3/24
 */
@Configuration
public class CustomConfiguration {

    @Bean
    public ServletRegistrationBean hystrixMetricsStreamServlet() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registration.setLoadOnStartup(1);
        registration.addUrlMappings("/actuator/hystrix.stream");
        registration.setName("HystrixMetricsStreamServlet");
        return registration;
    }
}
